<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<meta name="author" content="zhupeng">
	<title>白卡出入库明细查询</title>
	<script language="javascript" src="../script/common.js" type="text/javascript"></script>
	<script language="javascript" type="text/javascript">
		//全局变量
		var org = Common.cOrg();	//当前单位	
		var billId;
		var billType
		//页面加载方法
		function load(){
			Eui.showNavigation();
			setPages(["listview","detview","printview"]);
			//初始化卡片类型(查询form)
			Common.initDict(searchForm.cardType,"blankcard_type","全 部");
			//初始化单据类型(查询form)
			Common.initDict(searchForm.billType,"cardbill_type","全 部");
			//初始化状态(查询form)
			Common.initDict(searchForm.status,"commonbill_status","全 部");
			//初始化时间(查询form)
			Eui.initBeginDateInput("beginDateTd","起始日期","searchForm","beginDate","endDate","_pastDate");
			Eui.initEndDateInput("endDateTd","结束日期","searchForm","beginDate","endDate","_pastDate");
					
			createTable();		
		}				

		//设置表格数据列
		function createTable(){
			var columns = [];
			columns[0]={render:groupIdFunc,defOrder:true}
			qt = new QueryTable("white_list_query","searchForm","datalist",columns);
		}
	
		function groupIdFunc(v,r){//处理数据 点批次进入明细页面
			return "<a href=# onclick=\"showDetail("+r[8]+","+r[9]+");return false;\">"+v+"</a>"
		}
		
		function showDetail(id,type){
			billId = id
			billType = type
			CardStore.showBlankBill('detview',id,function(){return "<button type='button' onclick='printlnBlankBill()'>打印单据</button>";});	
		}
		//较验时间 
		function checkDate(){
			if(!checkForm(searchForm))return;
			qt.showTable();
		}

		//取消方法
		 function resetFunc(){
			switchPage('listview');
		}
		//选择卡片规格
		function selSpecs(){	
			CardStore.selCardSpec(  function(v){
										searchForm.cardSpecs.value = v.name;
								  	},
								  {type:searchForm.cardType.value})
		}
		
		function inspect(){
		  searchForm.cardSpecs.value="";
		}	
		//打印方法
		function printlnBlankBill(){
			requestframe.document.location.href = "print_blank_bill.html";
			switchPage("printview");
			//var v = openDialogFrame("/store/print_blank_bill.html?billType="+billType+"&billId="+billId,"打印单据",450,700);
		}
		//返回方法
		function closePrintDialog(){
			switchPage("detview");
		}
	</script>
</HEAD>
<body onload="load()">
	<!--页面导航-->
	<div class="nav"><div id="nav">&nbsp;</div></div>
	<!--查询静态页面部分-->
	<div id="listview" >	
		<!--查询条件form-->
		<form id="searchForm" name="searchForm">
			<div class="searchForm">
				<table cellSpacing=0 cellPadding=4 width="100%" border=0 class="label4">
					<tr>
				    	<td><label>单据编号</label> <input type="text" name="cardBillId"  onblur="checkV(this,'number')" maxlength="12" ></td>
						<td><label>单据类型</label> <select name="billType"><option></option></select></td>	
						<td><label>卡片类型</label> <select name="cardType" onchange="inspect()"><option></option></select></td>	
					</tr>
					<tr>
						<td id="beginDateTd">&nbsp;</td>
				    	<td id="endDateTd">&nbsp;</td>	
						<td><label>状&nbsp;&nbsp;&nbsp;&nbsp;态</label> <select name="status"  ><option></option></select></td>	
					</tr><tr>
						<td><label>卡片规格</label> <input type="text"  name="cardSpecs"><a class="orga" href="javascript:void(0)" onclick="selSpecs()" >&nbsp;&nbsp;</a></td>
						<td>&nbsp;</td>
						<td><button type="button" onclick="checkDate()">查 询</button></td> 
					</tr>	
				</table>
			</div>
		</form>
		<!--查询结构列表-->
			<div id="datalist"></div>	
	</div>		
	<!--明细(新增)静态页面部分-->			
	
	<div id="detview" style="display:none;" align="center"></div>
	<div class="printview" id="printview" style='display:none;'>
		<iframe id="requestframe" name="requestframe" style="width:100%;height:90%;overflow:auto;" frameborder=0 src=""></iframe>
	</div>
 </body>
</html>